#include <vector>
#include <iostream>

using namespace std;

int main()
{
    vector<int> vec = {1, 2, 3, 4, 5, 6};
    vector<int>::iterator begin = vec.begin();
    vector<int>::iterator end = vec.end();
    int val = 0;
    while (begin != end)
    {
        *begin = val;   // 正确：范围非空，因此 begin 指向一个元素
        ++begin;        // 移动迭代器，获取下一个元素
    }
    vector<int>::reverse_iterator rbegin = vec.rbegin();
    vector<int>::reverse_iterator rend = vec.rend();
    while (rbegin != rend)
    {
        cout << *rbegin << " ";
        ++rbegin; 
    }
    cout << endl;
}